package com.demo.resourcecode.c11mvc;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandlerControllerAdvice {

    private static final Logger logger = LoggerFactory.getLogger(GlobalExceptionHandlerControllerAdvice.class);

    @ExceptionHandler(value = RuntimeException.class)
    public String handle(Exception e){
        logger.error("统一异常处理捕获了异常", e);
        return "error";
    }

}